/*
 * @(#)org.example.netty.handler 2020/4/3/0003
 *
 * Copy Right@ 人人译视界
 */


package org.example.netty.handler;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;

/**
 * <pre>
 * @author tuwei
 *
 * @version 0.9
 *
 * 修改版本: 0.9
 * 修改日期: 2020/4/3/0003
 * 修改人 :  tuwei
 * 修改说明: 初步完成
 * 复审人 ：
 * </pre>
 */
public class MyClient {
	public static void main(String[] args) throws InterruptedException {
		EventLoopGroup group = new NioEventLoopGroup();

		try {
			Bootstrap bootstrap = new Bootstrap();
			bootstrap.group(group)
					.channel(NioSocketChannel.class)
					.handler(new MyClientInitializer());
			ChannelFuture sync = bootstrap.connect("127.0.0.1", 7000).sync();
			sync.channel().closeFuture().sync();
		}
		finally {
			group.shutdownGracefully();
		}
	}
}
